package com.hanfengyi.fallback;

import com.hanfengyi.feign.StaticPageFignClient;
import com.hanfengyi.hrm.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * User: Han
 * Date: 2020/2/27
 * Time: 12:58
 * Description:
 */
@Component
public class StaticPageFignFallBack implements FallbackFactory<StaticPageFignClient> {

    @Override
    public StaticPageFignClient create(Throwable throwable) {
        return new StaticPageFignClient() {
            @Override
            public AjaxResult pageStaticAction(String key, String name) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("发生了一点小问题:["+throwable.getMessage()+"]");
            }
        };
    }
}